"""
@title(TenX腾晓2024年12月考核答题文件)
@warning(请勿修改参数和返回值)
@warning(请认真填写__init__中的数据)
@author(1323230180)
@license(CC BY-SA 4.0 License)
"""
import os
from copy import deepcopy


class TenXClass:
    def __init__(self):
        # 获取当前文件名并截取文件名的学号-姓名
        file_name = os.path.basename(__file__).split('.')[0].split("-")
        self.id = file_name[0]  # 学号
        self.name = file_name[1]  # 姓名

    @staticmethod
    def question1(*args) -> list[str]:
        binary_tree = deepcopy(args[0])  # 传入的地牢结构（二叉树），详细请看BinaryTree.py
        a = []

        def f(self, root):
            while True:
                if root == None:
                    return
                elif root.left != 0 or root.left != None or root.right != None:
                    self.f(root.left)
                elif root.right != 0 or root.left != None or root.right != None:
                    self.f(root.right)
                elif root == 0 and root.left == None and root.right == None:
                    a.append(root.value)

                    return a

        f(binary_tree.root)




        

    @staticmethod
    def question2(*args) -> str:
        matrix = deepcopy(args[0])
        b = ''
        for i in range(0, len(matrix)):
            b += str(max(matrix[i]))

    # 传入的河流结构（矩阵）
        return b

    @staticmethod
    def question3(*args) -> int:
        a=52808343
        return a

    @staticmethod
    def question4(*args) -> int:
        n = deepcopy(args[0])
        a = 0
        i = 1
        x = 0
        while i > 0:
            a += (i * (i + 1)) / 2
            a = int(a)
            print(a)
            if a < n:
                i += 1
                x += 1
            elif n < a:
                break
            elif n == a:
                x += 1
                break
        # 用于搭建金字塔的球个数
        return x

    @staticmethod
    def question5(*args) -> str:
        balls = deepcopy(args[0])

        while balls[0] < 10000 or balls[1] < 10000 or balls[2] < 10000 or balls[3] < 10000 or balls[4] < 10000:
            for i in range(0, 5):
                balls[i] = balls[i - 1] + balls[i - 2]
                if balls[0] >= 10000 and balls[1] >= 10000 and balls[2] >= 10000 and balls[3] >= 10000 and balls[4] >= 10000:
                    break
        for m in range(0, 5):
            balls[m] = str(balls[m])
        # 五行空间球的初始值
        return balls